#!/usr/bin/python
# -*- coding: UTF-8 -*-

import tkinter as tk

# 创建窗体
window = tk.Tk()
window.title('Tk Demo')
window.geometry('350x500')

e = tk.Entry(
    window,
    show='*'
)
e.pack()

t = tk.Text(
    window,
    height=2,
    width=15
)
t.pack()


def insert_point():
    var = e.get()
    t.insert('insert', var)  # 插入到光标位置
    # t.insert(1.2, var)     # 插入到第1行、第2位后面


def insert_end():
    var = e.get()
    t.insert('end', var)   # 插入到最后面

b1 = tk.Button(
    window,
    text='insert_point',
    command=insert_point
)
b1.pack()

b2 = tk.Button(
    window,
    text='insert_end',
    command=insert_end
)
b2.pack()

window.mainloop()
